#!/usr/bin/env python

""" This example shows how to use the event system with the Game class. """

from sbak import video, event, game

SCREENRES = (640,480)

def handle_keydown(hk):
    print "Key pressed. Code:", hk.event.key

def handle_keyup(hk):
    print "Key released. Code:", hk.event.key

video.init()
event.init()

screen = video.set_mode(SCREENRES)

mygame = game.Game()

mygame.events.hook(handle_keydown, "keydown")
mygame.events.hook(handle_keyup, "keyup")

mygame.start()